# 定义类和方法

import requests
import app


class IhrmApi(object):

    def __init__(self):
        self.url = app.BASE_URL + "/api/sys/login"
        self.headers = app.HEADERS

    def login(self,json_data):
        resp = requests.post(url=self.url,headers=self.headers,json=json_data)
        return resp

        # 添加员工

    def add_emp(self, headers, req_data):
        resp = requests.post(url=app.BASE_URL + "/api/sys/user",
                             headers=headers,
                                 json=req_data)
        return resp

    def query_emp(self, emp_id, headers, ):
        resp = requests.get(url=app.BASE_URL + "/api/sys/user" + emp_id, headers=headers)
        return resp
